class ReplicasController < ApplicationController
  # GET /replicas
  # GET /replicas.xml
  def index
    @replicas = Replica.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @replicas }
    end
  end

  # GET /replicas/1
  # GET /replicas/1.xml
  def show
    @replica = Replica.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @replica }
    end
  end

  # GET /replicas/new
  # GET /replicas/new.xml
  def new
    @replica = Replica.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @replica }
    end
  end

  # GET /replicas/1/edit
  def edit
    @replica = Replica.find(params[:id])
  end

  # POST /replicas
  # POST /replicas.xml
  def create
    @replica = Replica.new(params[:replica])

    respond_to do |format|
      if @replica.save
        flash[:notice] = 'Replica was successfully created.'
        format.html { redirect_to(@replica) }
        format.xml  { render :xml => @replica, :status => :created, :location => @replica }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @replica.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /replicas/1
  # PUT /replicas/1.xml
  def update
    @replica = Replica.find(params[:id])

    respond_to do |format|
      if @replica.update_attributes(params[:replica])
        flash[:notice] = 'Replica was successfully updated.'
        format.html { redirect_to(@replica) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @replica.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /replicas/1
  # DELETE /replicas/1.xml
  def destroy
    @replica = Replica.find(params[:id])
    @replica.destroy

    respond_to do |format|
      format.html { redirect_to(replicas_url) }
      format.xml  { head :ok }
    end
  end
end
